package com.playball.lottery.frm.buyhall;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.playball.lottery.R;
import com.playball.lottery.ApplicationData;
import com.playball.lottery.base.BaseActivity;
import com.playball.lottery.customview.BallDTO;
import com.playball.lottery.customview.ChildDTO;
import com.playball.lottery.customview.ShowTipDialog;
import com.playball.lottery.nt.GetRequestParams;
import com.playball.lottery.util.ConvertJsonToList;
import com.playball.lottery.util.DefConstants;
import com.playball.lottery.util.LotUtil;
import com.playball.lottery.util.MyPreference;


public class FaQiHeMaiActivity extends BaseActivity implements DefConstants {
	private static final String TAG = "FaQiHeMaiActivity";
	// 顶部菜单栏
	private Button top_title_back;
	private TextView top_title_info;
	private Button top_title_refres;

	/** 彩票品种及合买期数 */
	private TextView buy_hemai_tv_issue;
	/** 方案金额 */
	private TextView buy_hemai_tv_amount;
	/** 认购金额 */
	private EditText buy_hemai_et_offer;
	/** 认购比例 */
	private TextView buy_hemai_tv_offer;
	/** 保底金额 */
	private EditText buy_hemai_et_guarantee;
	/** 保底比例 */
	private TextView buy_hemai_tv_guarantee;
	/** 全保 */
	private View buy_hemai_ll_guarantee_all;
	/** 佣金比例 0 */
	private View buy_hemai_ll_commission_0;
	/** 佣金比例 1 */
	private View buy_hemai_ll_commission_1;
	/** 佣金比例 2 */
	private View buy_hemai_ll_commission_2;
	/** 佣金比例 3 */
	private View buy_hemai_ll_commission_3;
	/** 佣金比例 4 */
	private View buy_hemai_ll_commission_4;
	/** 佣金比例 5 */
	private View buy_hemai_ll_commission_5;
	/** 佣金比例 6 */
	private View buy_hemai_ll_commission_6;
	/** 佣金比例 7 */
	private View buy_hemai_ll_commission_7;
	/** 佣金比例 8 */
	private View buy_hemai_ll_commission_8;
	/** 佣金比例 9 */
	private View buy_hemai_ll_commission_9;
	/** 佣金比例 10 */
	private View buy_hemai_ll_commission_10;
	/** 保密设置 - 公开 */
	private View buy_hemai_ll_secrecy_0;
	/** 保密设置 - 保密 */
	private View buy_hemai_ll_secrecy_1;
	/** 保密设置 - 销售结束后公开 */
	private View buy_hemai_ll_secrecy_2;
	/** 保密设置 - 对跟单者公开 */
	private View buy_hemai_ll_secrecy_3;
	/** 保密设置 - 销售截止后对跟单者公开 */
	private View buy_hemai_ll_secrecy_4;
	/** 合买宣言 */
	private EditText buy_hemai_et_description;
	/** 认购总额 */
	private TextView buy_hemai_tv_total;
	/** 认购总额说明 */
	private TextView buy_hemai_tv_total_describe;
	/** 发起合买 */
	private Button buy_hemai_btn_submit;

	/** 倍数 */
	private int bs;
	/** 单倍金额 */
	private int allMoney;
	/** 期次ID */
	private String issueID;
	/** 期次 */
	private String issueName;
	/** 彩票ID */
	private int lotID;
	/** 玩法 */
	private int playTypeId;
	/** 彩票号码列表 */
	private List<Map<String, Object>> list;
	/** 彩票号码 */
	private String Number;

	/** 认购金额 */
	private double offer;
	/** 保底金额 */
	private double guarantee;
	/** 总金额 */
	private int totalMoney;
	/** 最小认购金额 */
	double least;
	/** 佣金比例 */
	private int BonusScale = 0;
	/** 保密设置 */
	private int SecrecyLevel = 0;
	/** 佣金比例组 */
	private List<View> commission_list = new ArrayList<View>();
	/** 保密设置组 */
	private List<View> secrecy_list = new ArrayList<View>();

	private Handler handler = new Handler();

	private String strZQWF = "";
	private String strLQWF = "";
	private String strBDWF = "";

	List<ChildDTO> arrayList = new ArrayList<ChildDTO>();

	private String[] dyn;

	/**
	 * 重庆时时彩玩法
	 */
	private String strPlayType = "";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.buy_hemai2);
		initView();
		initData();
	}

	public void onResume() {
		super.onResume();
		
	}

	public void onPause() {
		super.onPause();
		
	}

	/**
	 * 初始化数据
	 */
	private void initData() {
		Intent intent = getIntent();
		bs = intent.getIntExtra("bs", 0);
		allMoney = intent.getIntExtra("AllMoney", 0);
		issueID = intent.getStringExtra("IssueID");
		issueName = intent.getStringExtra("IssueName");
		lotID = intent.getIntExtra("LotID", 0);
		playTypeId = intent.getIntExtra("PlayTypeId", 0);
		Number = intent.getStringExtra("Number");
		totalMoney = bs * allMoney;
		least = Math.ceil(totalMoney * 0.05f);
		strPlayType = intent.getStringExtra("PlayTypeName");

		// System.out.println(String.format("bs:%1$d, allMoney:%2$d, issueID:%3$s, issueName:%4$s, lotID:%5$d, playTypeId:%6$d, Number:%7$s",
		// bs, allMoney,
		// issueID, issueName, lotID, playTypeId, Number));

		if (lotID == LOT_ID_JCZQ) {
			strZQWF = intent.getStringExtra("strZQWF");
		} else if (lotID == LOT_ID_JCLQ) {
			strLQWF = intent.getStringExtra("strLQWF");
		} else if (lotID == LOT_ID_BD) {
			strBDWF = intent.getStringExtra("strBDWF");
		}

		// 获取彩票列表
		if (lotID == LOT_ID_SSQ) {
			list = getLotNumSSQ();
		} else if (lotID == LOT_ID_DLT) {
			list = getLotNumDLT();
		} else if (lotID == LOT_ID_11X5) {
			 list = getLotNum11X5();
		} else if (lotID == LOT_ID_11YDJ) {
			 list = getLotNum11YDJ();
		} else if (lotID == LOT_ID_CQSSC) {
			list = getLotNumCQSSC();
		} else if (lotID == LOT_ID_FC3D) {
			list = getLotNumFC3D();
		} else if (lotID == LOT_ID_QLC) {
			list = getLotNumQLC();
		} else if (lotID == LOT_ID_PL3) {
			list = getLotNumPL3();
		} else if (lotID == LOT_ID_PL5) {
			list = getLotNumPL5();
		} else if (lotID == LOT_ID_QXC) {
			list = getLotNumQXC();
		}
		// 显示数据
		if (lotID == LOT_ID_JCZQ || lotID == LOT_ID_JCLQ)
			buy_hemai_tv_issue.setText(String.format(getString(R.string.buy_hemai_tv_issue2), LotUtil.getLotNamebyID(lotID)));
		else
			buy_hemai_tv_issue.setText(String.format(getString(R.string.buy_hemai_tv_issue), LotUtil.getLotNamebyID(lotID),
					issueName));

		buy_hemai_tv_amount.setText(String.format(getString(R.string.buy_hemai_tv_amount), totalMoney));

		offer = Math.ceil(totalMoney * 0.05f);
		guarantee = 0.00f;

		buy_hemai_et_offer.setText("" + (int) offer);
		buy_hemai_et_guarantee.setText("" + (int) guarantee);

		buy_hemai_ll_guarantee_all.setSelected(false);
		buy_hemai_ll_commission_0.setSelected(true);
		buy_hemai_ll_secrecy_0.setSelected(true);

		doChange();
	}

	/**
	 * 获取彩票种类名称
	 * 
	 * @param lotID2
	 * @return
	 */
//	private String getLotName(int lotID2) {
//		String name = "";
//		switch (lotID2) {
//		case LOT_ID_SSQ:
//			name = "双色球";
//			break;
//		case LOT_ID_DLT:
//			name = "大乐透";
//			break;
//		case LOT_ID_11X5:
//			name = "11选5";
//			break;
//		case LOT_ID_11YDJ:
//			name = "11运夺金";
//			break;
//		case LOT_ID_CQSSC:
//			name = "重庆时时彩";
//			break;
//		case LOT_ID_FC3D:
//			name = "福彩3D";
//			break;
//		case LOT_ID_QLC:
//			name = "七乐彩";
//			break;
//		case LOT_ID_PL3:
//			name = "排列3";
//			break;
//		case LOT_ID_PL5:
//			name = "排列5";
//			break;
//		case LOT_ID_QXC:
//			name = "七星彩";
//			break;
//		case LOT_ID_ZQ_SFC:
//			name = "胜负彩";
//			break;
//		case LOT_ID_BD:
//			name = "北单";
//			break;
//		case LOT_ID_ZQ_RX9:
//			name = "任选9";
//			break;
//		case LOT_ID_JCZQ:
//			name = "竞彩足球";
//			break;
//		case LOT_ID_JCLQ:
//			name = "竞彩篮球";
//			break;
//		case LOT_ID_KUAI3:
//			name = "快3";
//			break;
//		}
//		return name;
//	}

	/**
	 * 初始化组件
	 */
	private void initView() {
		top_title_back = (Button) findViewById(R.id.top_title_back);
		top_title_back.setOnClickListener(view_onclick);
		top_title_info = (TextView) findViewById(R.id.top_title_info);
		top_title_info.setText("发起合买");
		top_title_refres = (Button) findViewById(R.id.top_title_refres);
		top_title_refres.setVisibility(View.INVISIBLE);

		buy_hemai_tv_issue = (TextView) findViewById(R.id.buy_hemai_tv_issue);
		buy_hemai_tv_amount = (TextView) findViewById(R.id.buy_hemai_tv_amount);
		buy_hemai_et_offer = (EditText) findViewById(R.id.buy_hemai_et_offer);
		buy_hemai_et_offer.addTextChangedListener(new TextWatcher() {
			@Override
			public void onTextChanged(CharSequence s, int start, int before, int count) {
				if (s.toString().equals("")) {
					offer = 0;
				} else {
					offer = Double.parseDouble(s.toString());
				}

				if (offer > totalMoney) {
					offer = totalMoney;
					handler.post(new Runnable() {
						@Override
						public void run() {
							// TODO Auto-generated method stub
							buy_hemai_et_offer.setText("" + (int) offer);
							buy_hemai_et_offer.selectAll();
						}
					});
				}/*
				 * else if(offer < least) { offer = least; handler.post(new
				 * Runnable() {
				 * 
				 * @Override public void run() { // TODO Auto-generated method
				 * stub buy_hemai_et_offer.setText(""+ (int)offer);
				 * buy_hemai_et_offer.selectAll(); } }); }
				 */

				// 全保的情况下，调整保底金额
				if (buy_hemai_ll_guarantee_all.isSelected()) {
					guarantee = totalMoney - offer;
					handler.post(new Runnable() {
						@Override
						public void run() {
							// TODO Auto-generated method stub
							buy_hemai_et_guarantee.setText("" + (int) guarantee);
							buy_hemai_et_guarantee.selectAll();
						}
					});
				}

				// 非全保情况，认购加上保底大于总金额的处理
				if (offer + guarantee > totalMoney) {
					guarantee = totalMoney - offer;
					handler.post(new Runnable() {
						@Override
						public void run() {
							// TODO Auto-generated method stub
							buy_hemai_et_guarantee.setText("" + (int) guarantee);
							buy_hemai_et_guarantee.selectAll();
						}
					});
				}

				doChange();
			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count, int after) {
				// TODO Auto-generated method stub
			}

			@Override
			public void afterTextChanged(Editable s) {
				// TODO Auto-generated method stub
			}
		});
		buy_hemai_tv_offer = (TextView) findViewById(R.id.buy_hemai_tv_offer);
		buy_hemai_et_guarantee = (EditText) findViewById(R.id.buy_hemai_et_guarantee);
		buy_hemai_et_guarantee.addTextChangedListener(new TextWatcher() {
			@Override
			public void onTextChanged(CharSequence s, int start, int before, int count) {
				if (s.toString().equals("")) {
					guarantee = 0;
				} else {
					guarantee = Double.parseDouble(s.toString());
				}

				double least = totalMoney - offer;
				if (guarantee > least) {
					guarantee = least;
					handler.post(new Runnable() {
						@Override
						public void run() {
							// TODO Auto-generated method stub
							buy_hemai_et_guarantee.setText("" + (int) guarantee);
							buy_hemai_et_guarantee.selectAll();
						}
					});
				}

				doChange();
			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count, int after) {
				// TODO Auto-generated method stub

			}

			@Override
			public void afterTextChanged(Editable s) {
				// TODO Auto-generated method stub

			}
		});
		buy_hemai_tv_guarantee = (TextView) findViewById(R.id.buy_hemai_tv_guarantee);
		buy_hemai_ll_guarantee_all = findViewById(R.id.buy_hemai_ll_guarantee_all);

		buy_hemai_ll_commission_0 = findViewById(R.id.buy_hemai_ll_commission_0);
		buy_hemai_ll_commission_1 = findViewById(R.id.buy_hemai_ll_commission_1);
		buy_hemai_ll_commission_2 = findViewById(R.id.buy_hemai_ll_commission_2);
		buy_hemai_ll_commission_3 = findViewById(R.id.buy_hemai_ll_commission_3);
		buy_hemai_ll_commission_4 = findViewById(R.id.buy_hemai_ll_commission_4);
		buy_hemai_ll_commission_5 = findViewById(R.id.buy_hemai_ll_commission_5);
		buy_hemai_ll_commission_6 = findViewById(R.id.buy_hemai_ll_commission_6);
		buy_hemai_ll_commission_7 = findViewById(R.id.buy_hemai_ll_commission_7);
		buy_hemai_ll_commission_8 = findViewById(R.id.buy_hemai_ll_commission_8);
		buy_hemai_ll_commission_9 = findViewById(R.id.buy_hemai_ll_commission_9);
		buy_hemai_ll_commission_10 = findViewById(R.id.buy_hemai_ll_commission_10);

		commission_list.add(buy_hemai_ll_commission_0);
		commission_list.add(buy_hemai_ll_commission_1);
		commission_list.add(buy_hemai_ll_commission_2);
		commission_list.add(buy_hemai_ll_commission_3);
		commission_list.add(buy_hemai_ll_commission_4);
		commission_list.add(buy_hemai_ll_commission_5);
		commission_list.add(buy_hemai_ll_commission_6);
		commission_list.add(buy_hemai_ll_commission_7);
		commission_list.add(buy_hemai_ll_commission_8);
		commission_list.add(buy_hemai_ll_commission_9);
		commission_list.add(buy_hemai_ll_commission_10);

		buy_hemai_ll_secrecy_0 = findViewById(R.id.buy_hemai_ll_secrecy_0);
		buy_hemai_ll_secrecy_1 = findViewById(R.id.buy_hemai_ll_secrecy_1);
		buy_hemai_ll_secrecy_2 = findViewById(R.id.buy_hemai_ll_secrecy_2);
		buy_hemai_ll_secrecy_3 = findViewById(R.id.buy_hemai_ll_secrecy_3);
		buy_hemai_ll_secrecy_4 = findViewById(R.id.buy_hemai_ll_secrecy_4);

		secrecy_list.add(buy_hemai_ll_secrecy_0);
		secrecy_list.add(buy_hemai_ll_secrecy_1);
		secrecy_list.add(buy_hemai_ll_secrecy_2);
		secrecy_list.add(buy_hemai_ll_secrecy_3);
		secrecy_list.add(buy_hemai_ll_secrecy_4);

		buy_hemai_et_description = (EditText) findViewById(R.id.buy_hemai_et_description);
		buy_hemai_tv_total = (TextView) findViewById(R.id.buy_hemai_tv_total);
		buy_hemai_tv_total_describe = (TextView) findViewById(R.id.buy_hemai_tv_total_describe);
		buy_hemai_btn_submit = (Button) findViewById(R.id.buy_hemai_btn_submit);
		buy_hemai_btn_submit.setOnClickListener(view_onclick);
	}

	/**
	 * 认购、佣金改变
	 */
	private void doChange() {
		buy_hemai_tv_offer.setText(String.format(getString(R.string.buy_hemai_tv_percent), offer * 100 / totalMoney));
		buy_hemai_tv_guarantee.setText(String.format(getString(R.string.buy_hemai_tv_percent), guarantee * 100
				/ totalMoney));
		buy_hemai_tv_total.setText(String.format(getString(R.string.buy_hemai_tv_total), (int) (offer + guarantee)));
		buy_hemai_tv_total_describe.setText(String.format(getString(R.string.buy_hemai_tv_total_describe), (int) offer,
				(int) guarantee));
		if (offer + guarantee == totalMoney) {
			buy_hemai_ll_guarantee_all.setSelected(true);
		} else {
			buy_hemai_ll_guarantee_all.setSelected(false);
		}
	}

	/**
	 * 点击事件（代码调用）
	 */
	private View.OnClickListener view_onclick = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.top_title_back: // 回退
				finish();
				break;
			case R.id.buy_hemai_btn_submit: // 发起合买
				doSubmit();
				break;
			}
		}
	};

	/**
	 * 点击事件（XML配置）
	 * 
	 * @param v
	 */
	public void btn_onclick(View v) {
		v.setSelected(!v.isSelected());
		switch (v.getId()) {
		case R.id.buy_hemai_ll_guarantee_all: // 全保
			if (buy_hemai_ll_guarantee_all.isSelected()) {
				guarantee = totalMoney - offer;
			} else {
				guarantee = 0;
			}
			buy_hemai_et_guarantee.setText("" + (int) guarantee);
			break;
		case R.id.buy_hemai_ll_commission_0: // 佣金比例
		case R.id.buy_hemai_ll_commission_1:
		case R.id.buy_hemai_ll_commission_2:
		case R.id.buy_hemai_ll_commission_3:
		case R.id.buy_hemai_ll_commission_4:
		case R.id.buy_hemai_ll_commission_5:
		case R.id.buy_hemai_ll_commission_6:
		case R.id.buy_hemai_ll_commission_7:
		case R.id.buy_hemai_ll_commission_8:
		case R.id.buy_hemai_ll_commission_9:
		case R.id.buy_hemai_ll_commission_10:
			doCommission(v.getId());
			break;
		case R.id.buy_hemai_ll_secrecy_0: // 保密设置 - 公开
		case R.id.buy_hemai_ll_secrecy_1: // 保密设置 - 保密
		case R.id.buy_hemai_ll_secrecy_2: // 保密设置 - 销售结束后公开
		case R.id.buy_hemai_ll_secrecy_3: // 保密设置 - 对跟单者公开
		case R.id.buy_hemai_ll_secrecy_4: // 保密设置 - 销售截止后对跟单者公开
			doSecrecy(v.getId());
			break;
		}
	}

	/**
	 * 发起合买
	 */
	protected void doSubmit() {

		if (offer < least) {
			buy_hemai_et_offer.setError("认购金额需满总金额的5%，至少" + least + "元");
			return;
		}

		if (strLQWF.equals("HHTZ")) {
			dyn = new String[2];
			JSONObject params = new JSONObject();
			try {
				// 设置请求所需参数
				JSONObject params0 = new JSONObject();
				params0.put("playid", 9105);
				params0.put("number", Number);
				params.put("SchemeType", 2);// 方案类型 1自购，2合买，3保存 1
				params.put("BetType", 1);// 投注类型 1选号投注 2单式上传 3先发后传 1
				params.put("BonusScale", BonusScale);
				params.put("AssureShare", guarantee);
				params.put("Description", "");
				params.put("OpenUserList", "");
				params.put("SecrecyLevel", SecrecyLevel);
				params.put("BuyShare", offer);
				params.put("Multiple", bs);
				params.put("IssueID", "2016");
				params.put("LotteryID", lotID);
				params.put("IssueName", issueName);
				params.put("Number", "[" + params0.toString() + "]");
				params.put("Money", totalMoney);
			} catch (JSONException ex) {
				Log.d(TAG, ex.toString());
			}
			dyn[0] = params.toString();
			dyn[1] = "207";

			AsyncLoader task = new AsyncLoader();
			task.execute(dyn);

		} else if (strZQWF.equals("HHTZ")) {
			dyn = new String[2];
			JSONObject params = new JSONObject();
			try {
				// 设置请求所需参数
				JSONObject params0 = new JSONObject();
				params0.put("playid", 9005);
				params0.put("number", Number);
				params.put("SchemeType", 2);// 方案类型 1自购，2合买，3保存 1
				params.put("BetType", 1);// 投注类型 1选号投注 2单式上传 3先发后传 1
				params.put("BonusScale", BonusScale);
				params.put("AssureShare", guarantee);
				params.put("Description", "");
				params.put("OpenUserList", "");
				params.put("SecrecyLevel", SecrecyLevel);
				params.put("BuyShare", offer);
				params.put("Multiple", bs);
				params.put("IssueID", "2016");
				params.put("LotteryID", lotID);
				params.put("IssueName", issueName);
				params.put("Number", "[" + params0.toString() + "]");
				params.put("Money", totalMoney);
			} catch (JSONException ex) {
				Log.d(TAG, ex.toString());
			}
			dyn[0] = params.toString();
			dyn[1] = "207";

			AsyncLoader task = new AsyncLoader();
			task.execute(dyn);

		}

		else {
			dyn = new String[2];
			JSONObject params = new JSONObject();
			try {
				// 设置请求所需参数
				params.put("SchemeType", 2);// 方案类型 1自购，2合买，3保存 1
				params.put("BetType", 1);// 投注类型 1选号投注 2单式上传 3先发后传 1
				params.put("BonusScale", BonusScale);
				params.put("AssureShare", guarantee);
				params.put("Description", buy_hemai_et_description.getText().toString());
				params.put("OpenUserList", "");
				params.put("SecrecyLevel", SecrecyLevel);
				params.put("BuyShare", offer);
				params.put("Multiple", bs);
				params.put("LotteryID", lotID);
				params.put("IssueName", issueName);
				params.put("IssueID", issueID);
				// 投注号码
				if (lotID == LOT_ID_ZQ_SFC || lotID == LOT_ID_ZQ_RX9 || lotID == LOT_ID_JCZQ || lotID == LOT_ID_JCLQ
						|| lotID == LOT_ID_BD) {
					params.put("Number", Number);
				} else {
					JSONArray array1 = new JSONArray();
					for (int i = 0; i < list.size(); i++) {
						JSONObject o = new JSONObject(list.get(i));
						array1.put(o);
					}
					params.put("Number", array1);
				}
				params.put("Money", totalMoney);
			} catch (JSONException ex) {
				Log.d(TAG, ex.toString());
			}
			dyn[0] = params.toString();
			dyn[1] = "207";

			AsyncLoader task = new AsyncLoader();
			task.execute(dyn);
		}
	}

	private class AsyncLoader extends AsyncTask<String, Integer, String> {
		String action;
		ShowTipDialog showdialog = new ShowTipDialog();

		@Override
		protected void onPreExecute() {
			showdialog.showDialog(FaQiHeMaiActivity.this);
		}

		@Override
		protected String doInBackground(String... params) {
			String strResult = null;
			action = params[1];
			String UserID = ApplicationData.getInstance().getUserID();
			strResult = GetRequestParams.getRequestUserIDResult(params[0], UserID, action, getApplicationContext());
			return strResult;
		}

		@Override
		protected void onPostExecute(String result) {
			try {
				if (result == null) {
					return;
				}
				int buy_icon;
				JSONTokener jsonParser = new JSONTokener(result);
				JSONObject js = (JSONObject) jsonParser.nextValue();
				if (Integer.parseInt(js.getString("Code")) != 0) {
					buy_icon = R.drawable.buy_failure;
					new ShowTipDialog().showHBuyInfo(FaQiHeMaiActivity.this, js.getString("Data"), "购买失败", buy_icon);
				} else {
					buy_icon = R.drawable.buy_success;

					Map<String, Object> map = new HashMap<String, Object>();
					map = ConvertJsonToList.getMap(js.getString("Data"));
					// 合买成功后，弹出提示框中添加保底信息
					String msg = "发起" + LotUtil.getLotNamebyID(lotID);
					if (lotID != LOT_ID_JCZQ && lotID != LOT_ID_JCLQ) {
						msg = msg + "第" + issueName + "期";
					}
					msg = msg + "合买方案\n\n方案金额：" + totalMoney + "元\n我的认购：" + offer + "元\n我的保底：" + guarantee/* + "元\n账户余额："
							+ ConvertJsonToList.getMap(js.getString("Data")).get("Balance").toString()*/ + "元";
					new ShowTipDialog().showBuyInfo(FaQiHeMaiActivity.this, msg, "投注成功", buy_icon, dyn[0]);
					// 存贮数据
					MyPreference.getInstance(FaQiHeMaiActivity.this).storeBLotID(lotID);

				}
			} catch (JSONException ex) {
				Log.e(TAG, ex.toString());
			} finally {
				showdialog.closeDialog();
			}
		}

	}

	/**
	 * 点选保密
	 * 
	 * @param id
	 */
	private void doSecrecy(int id) {
		for (int i = 0; i < secrecy_list.size(); i++) {
			View view = secrecy_list.get(i);
			if (view.getId() == id) {
				view.setSelected(true);
				switch (id) {
				case R.id.buy_hemai_ll_secrecy_0: // 保密设置 - 公开
					SecrecyLevel = 0;
					break;
				case R.id.buy_hemai_ll_secrecy_1: // 保密设置 - 保密
					SecrecyLevel = 4;
					break;
				case R.id.buy_hemai_ll_secrecy_2: // 保密设置 - 销售结束后公开
					SecrecyLevel = 1;
					break;
				case R.id.buy_hemai_ll_secrecy_3: // 保密设置 - 对跟单者公开
					SecrecyLevel = 2;
					break;
				case R.id.buy_hemai_ll_secrecy_4: // 保密设置 - 销售截止后对跟单者公开
					SecrecyLevel = 3;
					break;
				}
			} else {
				if (view.isSelected())
					view.setSelected(false);
			}
		}
	}

	/**
	 * 点选佣金
	 * 
	 * @param id
	 */
	private void doCommission(int id) {
		for (int i = 0; i < commission_list.size(); i++) {
			View view = commission_list.get(i);
			if (view.getId() == id) {
				view.setSelected(true);
				switch (id) {
				case R.id.buy_hemai_ll_commission_0:
					BonusScale = 0;
					break;
				case R.id.buy_hemai_ll_commission_1:
					BonusScale = 1;
					break;
				case R.id.buy_hemai_ll_commission_2:
					BonusScale = 2;
					break;
				case R.id.buy_hemai_ll_commission_3:
					BonusScale = 3;
					break;
				case R.id.buy_hemai_ll_commission_4:
					BonusScale = 4;
					break;
				case R.id.buy_hemai_ll_commission_5:
					BonusScale = 5;
					break;
				case R.id.buy_hemai_ll_commission_6:
					BonusScale = 6;
					break;
				case R.id.buy_hemai_ll_commission_7:
					BonusScale = 7;
					break;
				case R.id.buy_hemai_ll_commission_8:
					BonusScale = 8;
					break;
				case R.id.buy_hemai_ll_commission_9:
					BonusScale = 9;
					break;
				case R.id.buy_hemai_ll_commission_10:
					BonusScale = 10;
					break;
				}
			} else {
				if (view.isSelected())
					view.setSelected(false);
			}
		}
	}

	/**
	 * 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumSSQ() {
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_ssqdto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String ssq_ball = elvdto.getSsq_ball();
			ssq_ball = ssq_ball.replace("-", " + ");
			ssq_ball = ssq_ball.substring(0, ssq_ball.lastIndexOf("+"));
			ssq_ball = ssq_ball.replace(",", " ");
			// Log.v("getLotNum1ss", "ssq_ball= "+ssq_ball.toString());
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("number", ssq_ball);

			if ((ssq_ball.split("\\+")[0]).length() > 18 || ((ssq_ball.split("\\+")[1]).length() > 4)) {
				map.put("playid", SSQ_ZX_F);// "07 11 12 15 26 30 33 + 05"或"07 11 12 15 26 30 + 05 08"
			} else {
				map.put("playid", SSQ_ZX_D);// 单式
			}
			list.add(map);
		}
		// Log.v("getLotNum", "list= " + list.toString());
		return list;
	}

	/**
	 * 大乐透拼接投注号码
	 * 
	 * @return
	 */
	// public List<Map<String, Object>> getLotNumDLT() {
	// List<BallDTO> arrayList = ApplicationData.getInstance().getList_dltdto();
	// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
	// for (BallDTO elvdto : arrayList) {
	// String elv_ball = elvdto.getDlt_ball();
	// elv_ball = elv_ball.replace("-", " + ");
	// elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("+"));
	// // Log.v("getLotNum", "elv_ball= "+elv_ball.toString());
	// // Log.e("getLotNum", "elv_ball.length()= "+elv_ball.length());
	// Map<String, Object> map = new HashMap<String, Object>();
	// map.put("number", elv_ball);
	// // Log.e("getLotNum",
	// "elv_ball111.length()= "+(elv_ball.split("\\+")[0]).length());
	// // Log.e("getLotNum",
	// "elv_ball222.length()= "+(elv_ball.split("\\+")[1]).length());
	// if((elv_ball.split("\\+")[0]).length()>15||((elv_ball.split("\\+")[1]).length()>7)){
	// map.put("playid", DLT_ZX_F);//"01 12 19 21 23 35 + 01 10 12";
	// }else{
	// map.put("playid", DLT_ZX_D);//"01 19 21 23 35 + 01 10";
	// }
	// list.add(map);
	// }
	// // Log.v("getLotNum", "list= "+list.toString());
	// return list;
	// }

	/**
	 * 大乐透拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumDLT() {
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_dltdto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getDlt_ball();
			elv_ball = elv_ball.split("-")[0] + "-" + elv_ball.split("-")[1] + "-" + elv_ball.split("-")[2];
			elv_ball = elv_ball.replace("-", " + ");
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("+"));

			Map<String, Object> map = new HashMap<String, Object>();
			map.put("number", elv_ball);
			// Log.e("getLotNum",
			// "elv_ball111.length()= "+(elv_ball.split("\\+")[0]).length());
			// Log.e("getLotNum",
			// "elv_ball222.length()= "+(elv_ball.split("\\+")[1]).length());
			if (ApplicationData.getInstance().getIsDLTZhuiJiaClick() != null) {
				if (ApplicationData.getInstance().getIsDLTZhuiJiaClick()) {
					if ((elv_ball.split("\\+")[0]).length() > 15 || ((elv_ball.split("\\+")[1]).length() > 7)) {
						map.put("playid", 3904);// "01 12 19 21 23 35 + 01 10 12";
					} else {
						map.put("playid", 3903);// "01 19 21 23 35 + 01 10";
					}
				} else {
					if ((elv_ball.split("\\+")[0]).length() > 15 || ((elv_ball.split("\\+")[1]).length() > 7)) {
						map.put("playid", DLT_ZX_F);// "01 12 19 21 23 35 + 01 10 12";
					} else {
						map.put("playid", DLT_ZX_D);// "01 19 21 23 35 + 01 10";
					}
				}
			} else {
				if ((elv_ball.split("\\+")[0]).length() > 15 || ((elv_ball.split("\\+")[1]).length() > 7)) {
					map.put("playid", DLT_ZX_F);// "01 12 19 21 23 35 + 01 10 12";
				} else {
					map.put("playid", DLT_ZX_D);// "01 19 21 23 35 + 01 10";
				}
			}

			list.add(map);
		}
		return list;
	}

	/**
	 * 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNum11X5() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_11x5dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getElv_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			// Log.e("getLotNum", "elv_ball= "+elv_ball.toString());
			if (playTypeId == 7010) {
				String nums[] = elv_ball.split("\\|");
				String first[] = nums[0].split(" ");
				String second[] = nums[1].split(" ");
				String third[] = nums[2].split(" ");
				for (String a : first) {
					for (String b : second) {
						if (!a.equals(b)) {
							for (String c : third) {
								if (!c.equals(b) && !c.equals(a)) {
									lotNum = lotNum + a + "|" + b + "|" + c + "&";// lotNum
																					// =
																					// lotNum
																					// +
																					// a
																					// +
																					// "|"
																					// +
																					// b
																					// +
																					// "|"
																					// +
																					// c
																					// +
																					// "\n"
									// Log.v("getLotNum",
									// "lotNum1= "+lotNum.toString());
								}
							}
						}
					}
				}
			} else if (playTypeId == 7009) {
				String nums[] = elv_ball.split("\\|");
				String first[] = nums[0].split(" ");
				String second[] = nums[1].split(" ");
				for (String a : first) {
					for (String b : second) {
						if (!a.equals(b)) {
							lotNum = lotNum + a + "|" + b + "&";
						}
					}
				}
			} else {
				lotNum = elv_ball.replace(",", " ");
				Map<String, Object> map = null;
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", lotNum);
				list.add(map);
			}
		}
		// 处理拆分数据
		if (playTypeId == 7010 || playTypeId == 7009) {
			String number[] = (lotNum.substring(0, lotNum.length() - 1)).split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", num);
				list.add(map);
			}
		}
		return list;
	}

	/**
	 * 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNum11YDJ() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_11x5dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getElv_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			// Log.e("getLotNum", "elv_ball= "+elv_ball.toString());
			if (playTypeId == 6210) {
				String nums[] = elv_ball.split("\\|");
				String first[] = nums[0].split(" ");
				String second[] = nums[1].split(" ");
				String third[] = nums[2].split(" ");
				for (String a : first) {
					for (String b : second) {
						if (!a.equals(b)) {
							for (String c : third) {
								if (!c.equals(b) && !c.equals(a)) {
									lotNum = lotNum + a + "|" + b + "|" + c + "&";
								}
							}
						}
					}
				}
			} else if (playTypeId == 6209) {
				String nums[] = elv_ball.split("\\|");
				String first[] = nums[0].split(" ");
				String second[] = nums[1].split(" ");
				for (String a : first) {
					for (String b : second) {
						if (!a.equals(b)) {
							lotNum = lotNum + a + "|" + b + "&";
						}
					}
				}
			} else {
				lotNum = elv_ball.replace(",", " ");
				Map<String, Object> map = null;
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", lotNum);
				list.add(map);
			}
		}
		// 处理拆分数据
		if (playTypeId == 6210 || playTypeId == 6209) {
			String number[] = (lotNum.substring(0, lotNum.length() - 1)).split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", num);
				list.add(map);
			}
		}
		return list;
	}

	/**
	 * 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumCQSSC() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_cqsscdto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getElv_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			elv_ball = elv_ball.replaceAll(" ", "");
			lotNum = elv_ball.replaceAll("\\|", ",");
			if (strPlayType.equals("五星直选")) {
			} else if (strPlayType.equals("五星通选")) {
				// playTypeId =2806;
			} else if (strPlayType.equals("五星复选")) {
				// playTypeId =2802;
			} else if (strPlayType.equals("三星直选")) {
				lotNum = "-,-," + lotNum;
			} else if (strPlayType.equals("三星复选")) {
				// playTypeId =2802;
				lotNum = "-,-," + lotNum;
			} else if (strPlayType.equals("二星直选")) {
				lotNum = "-,-,-," + lotNum;
			} else if (strPlayType.equals("二星组选")) {
				// playTypeId =2808;
				String addnum = "";
				String[] nums = lotNum.split("");
				for (int i = 0; i < nums.length; i++) {
					// System.out.println("nums[i]= "+nums[i]);
					if (!nums[i].equals("")) {
						addnum = addnum + "," + nums[i];
					}
				}
				if (addnum.startsWith(",")) {
					addnum = addnum.substring(1);
				}
				lotNum = addnum;
			} else if (strPlayType.equals("二星复选")) {
				// playTypeId =2802;
				lotNum = "-,-,-," + lotNum;
			} else if (strPlayType.equals("一星复式")) {
				lotNum = "-,-,-,-," + lotNum;
			} else if (strPlayType.equals("大小单双复式")) {
				lotNum = lotNum.replaceAll(",", "");
			}
			Map<String, Object> map = null;
			map = new HashMap<String, Object>();
			map.put("playid", playTypeId);
			map.put("number", lotNum);
			list.add(map);
		}
		return list;
	}
	
	/**
	 * 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumFC3D() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_pl3dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getPl3_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			elv_ball = elv_ball.replaceAll(" ", "").trim();
			// Log.e("getLotNum1ss", "elv_ball= "+elv_ball.toString());
			if (playTypeId == 602) {
				String[] tempLotNum = elv_ball.split("\\|");
				for (int i = 0; i < tempLotNum.length; i++) {
					// 处理复式
					if (tempLotNum[i].length() > 1) {
						lotNum = lotNum + "(" + tempLotNum[i] + ")";
					} else {
						lotNum = lotNum + tempLotNum[i];
					}
				}
				lotNum = lotNum + "&";
			}
			if (playTypeId == 604 || playTypeId == 605) {
				lotNum = lotNum + elv_ball.replace(",", " ") + "&";
			}
		}

		lotNum = lotNum.substring(0, lotNum.lastIndexOf("&"));
		// Log.v("getLotNum", "lotNum= "+lotNum.toString());
		// 处理拆分数据
		if (playTypeId == 602) {// 直选，
			String number[] = lotNum.split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				// Log.i("getLotNum", "num= "+num.toString());
				// Log.i("getLotNum", "num.length()= "+num.length());
				map = new HashMap<String, Object>();
				if (num.length() > 3) {
					map.put("playid", 602);
				} else {
					map.put("playid", 601);
				}
				map.put("number", num);
				list.add(map);
			}
		}
		// 组选3 ，组选6
		if (playTypeId == 604 || playTypeId == 605) {
			String number[] = lotNum.split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				// Log.i("getLotNum", "num= "+num.toString());
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", num);
				list.add(map);
			}
		}
		// Log.v("getLotNum", "list= "+list.toString());
		return list;
	}

	/**
	 * 七乐彩拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumQLC() {
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_pl3dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getPl3_ball();
			// Log.i("getLotNum1ss", "elv_ball1= "+elv_ball.toString());
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("number", elv_ball);
			if (elv_ball.length() < 23) {
				map.put("playid", QLC_ZX_D);// 单式 elv_ball= 10 12 23 27 28 29 30
			} else {
				map.put("playid", QLC_ZX_F);// elv_ball= 01 10 12 23 27 28 29 30
			}
			list.add(map);
		}
		// Log.v("getLotNums", "list= "+list.toString());
		return list;
	}

	/**
	 * 竞彩足球拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumJCZQ() {
		arrayList = ApplicationData.getInstance().getList_jcdto();
		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
		if (strZQWF.equals("RQSPF") || (strZQWF.equals("SPF"))) {
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_sp = child.getStr_sp();
				// 拿到新的号码放到List
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_sp", str_sp);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				list1.add(map);
			}
			return list1;
		} else {
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_content = "";
				String selsps = child.getBqc_selectsp();// 3种通用
				if (strZQWF.equals("BQC")) {
					str_content = child.getBtnBQCcontent();
				} else if (strZQWF.equals("ZJQ")) {
					str_content = child.getSelectZJQCG();
				} else if (strZQWF.equals("BF")) {
					str_content = child.getBtnbfAllcontent();
				}
				// 拿到新的号码放到List
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_touzhu", str_content);
				map.put("buy_jcxhlb_list_sp", selsps);
				// map.put("buy_jcxhlb_list_sp", jc_sp);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				list1.add(map);
				// Log.v("FaQiHeMaiJCActivity",
				// "getJCZQBQCData list= "+list.toString());
			}
			return list1;
		}
	}

	/**
	 * 北单拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumBD() {
		arrayList = ApplicationData.getInstance().getList_jcdto();
		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
		if (strBDWF.equals("RQSPF") || (strBDWF.equals("SXDS"))) {
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_sp = child.getStr_sp();
				// 拿到新的号码放到List
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_sp", str_sp);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				list1.add(map);
			}
			return list1;
		} else {
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_content = "";
				String selsps = child.getBqc_selectsp();// 3种通用
				if (strBDWF.equals("BQC")) {
					str_content = child.getBtnBQCcontent();
				} else if (strBDWF.equals("ZJQ")) {
					str_content = child.getSelectZJQCG();
				} else if (strBDWF.equals("BF")) {
					str_content = child.getBtnbfAllcontent();
				}
				// 拿到新的号码放到List
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_touzhu", str_content);
				map.put("buy_jcxhlb_list_sp", selsps);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				list1.add(map);
			}
			return list1;
		}
	}

	/**
	 * 竞彩篮球拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumJCLQ() {
		arrayList = ApplicationData.getInstance().getList_jcdto();
		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
		if (!strLQWF.equals("SFC")) {
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_sp = child.getStr_sp();
				// 拿到新的号码放到List
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_sp", str_sp);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				map.put("list_strLQWF", strLQWF);
				list1.add(map);
			}
			return list1;
		} else {// 胜分差
			for (ChildDTO child : arrayList) {
				String jc_mid = child.getmId();
				String str_hteam = child.gethTeam();
				String str_vteam = child.getvTeam();
				String str_content = "";
				String selsps = child.getBqc_selectsp();// 和足球3种通用 adap
														// GetFootList方法
				str_content = child.getBtnsfcAllcontent();
				// 拿到新的号码放到List
				HashMap<String, Object> map = new HashMap<String, Object>();
				map.put("buy_jcxhlb_list_mid", jc_mid);
				map.put("buy_jcxhlb_list_hteam", str_hteam);
				map.put("buy_jcxhlb_list_vteam", str_vteam);
				map.put("buy_jcxhlb_list_touzhu", str_content);
				map.put("buy_jcxhlb_list_sp", selsps);
				map.put("buy_jcxhlb_list_delete", R.drawable.default_delbtn02);
				map.put("tip_time", child.geteTime());
				list1.add(map);
			}
			return list1;
		}
	}

	/**
	 * 七星彩拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumQXC() {
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_pl3dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getPl3_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			elv_ball = elv_ball.replaceAll(" ", "").trim();
			// Log.v("getLotNum", "elv_ball= "+elv_ball.toString());
			Map<String, Object> map = new HashMap<String, Object>();
			if (elv_ball.length() < 14) {
				map.put("playid", QXC_ZX_D);// String s2="2|3|6|6|1|7|9";
				String lotNum = "";
				String[] tempLotNum = elv_ball.split("\\|");
				for (int i = 0; i < tempLotNum.length; i++) {
					lotNum = lotNum + tempLotNum[i];
				}
				map.put("number", lotNum);
			} else {
				map.put("playid", QXC_ZX_F);// String s1="3|48|7|6|1|0|9";
				String lotNum = "";
				String[] tempLotNum = elv_ball.split("\\|");
				for (int i = 0; i < tempLotNum.length; i++) {
					if (tempLotNum[i].length() > 1) {
						lotNum = lotNum + "(" + tempLotNum[i] + ")";
					} else {
						lotNum = lotNum + tempLotNum[i];
					}
				}
				map.put("number", lotNum);
			}
			list.add(map);
		}
		// Log.v("getLotNum", "list= "+list.toString());
		return list;
	}

	/**
	 * 排列3 拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumPL3() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_pl3dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getPl3_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			elv_ball = elv_ball.replaceAll(" ", "").trim();
			// Log.e("getLotNum1", "elv_ball= "+elv_ball.toString());
			if (playTypeId == 6302) {
				String[] tempLotNum = elv_ball.split("\\|");
				for (int i = 0; i < tempLotNum.length; i++) {
					// 处理复式
					if (tempLotNum[i].length() > 1) {
						lotNum = lotNum + "(" + tempLotNum[i] + ")";
					} else {
						lotNum = lotNum + tempLotNum[i];
					}
				}
				lotNum = lotNum + "&";
			}
			if (playTypeId == 6304 || playTypeId == 6305) {
				lotNum = lotNum + elv_ball.replace(",", " ") + "&";
			}
		}
		lotNum = lotNum.substring(0, lotNum.lastIndexOf("&"));
		// Log.v("getLotNum", "lotNum= "+lotNum.toString());
		// 处理拆分数据
		if (playTypeId == 6302) {// 直选，
			String number[] = lotNum.split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				// Log.i("getLotNum", "num= "+num.toString());
				// Log.i("getLotNum", "num.length()= "+num.length());
				map = new HashMap<String, Object>();
				if (num.length() > 3) {
					map.put("playid", 6302);
				} else {
					map.put("playid", 6301);
				}
				map.put("number", num);
				list.add(map);
			}
		}
		// 组选3 ，组选6
		if (playTypeId == 6304 || playTypeId == 6305) {
			String number[] = lotNum.split("&");
			Map<String, Object> map = null;
			for (String num : number) {
				// Log.i("getLotNum", "num= "+num.toString());
				map = new HashMap<String, Object>();
				map.put("playid", playTypeId);
				map.put("number", num);
				list.add(map);
			}
		}
		// Log.e("getLotNum", "list= "+list.toString());
		return list;
	}

	/**
	 * 排列5拼接投注号码
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getLotNumPL5() {
		String lotNum = "";
		List<BallDTO> arrayList = ApplicationData.getInstance().getList_pl5dto();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		for (BallDTO elvdto : arrayList) {
			String elv_ball = elvdto.getPl5_ball();
			elv_ball = elv_ball.substring(0, elv_ball.lastIndexOf("-"));
			elv_ball = elv_ball.replaceAll(" ", "").trim();
			// Log.v("getLotNum1ss", "elv_ball= "+elv_ball.toString());
			String[] tempLotNum = elv_ball.split("\\|");
			for (int i = 0; i < tempLotNum.length; i++) {
				// 处理复式
				if (tempLotNum[i].length() > 1) {
					lotNum = lotNum + "(" + tempLotNum[i] + ")";
				} else {
					lotNum = lotNum + tempLotNum[i];
				}
			}
			lotNum = lotNum + "&";
		}

		lotNum = lotNum.substring(0, lotNum.lastIndexOf("&"));
		// Log.v("getLotNum", "lotNum= "+lotNum.toString());
		// 处理拆分数据
		// 直选，
		String number[] = lotNum.split("&");
		Map<String, Object> map = null;
		for (String num : number) {
			// Log.i("getLotNum", "num= "+num.toString());
			// Log.i("getLotNum", "num.length()= "+num.length());
			map = new HashMap<String, Object>();
			if (num.length() > 5) {
				map.put("playid", 6402);
			} else {
				map.put("playid", 6401);
			}
			map.put("number", num);
			list.add(map);
		}

		// Log.v("getLotNum", "list= "+list.toString());
		return list;
	}
}